package edu.stanford.bmir.protege.web.server.stkosutil.common.search;

import edu.stanford.bmir.protege.web.client.rpc.stkosutil.common.MetaItemList;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.common.SearchCondition;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.common.UtilConstants;

public class UtilMatcher {
	public boolean matchMappingNo(String comment, int mappingNo, String projectName){
		boolean result = false;
		int currentMappingNo = MetaItemList.extractPreProjectMappingNumber(comment, projectName);
		if (currentMappingNo!=UtilConstants.UNKNOWN_INT_VALUE){
			if (currentMappingNo==mappingNo){
				return true;
			}
		}
		return result;
	}
	public boolean matchSearchCondition(String comment, SearchCondition searchCondition){
		int mappingNo = searchCondition.getMappingNo();
		return this.matchMappingNo(comment, mappingNo, searchCondition.getRefProjectName());
	}
}
